#ifndef TCPSOCKET_HPP
#define TCPSOCKET_HPP

#include "sockets.hpp"

class SocketData;

class TcpSocket
{
	public:
	
	TcpSocket( bool blocking = true );
	TcpSocket( TcpSocket const& tcpSocket );
	~TcpSocket();

	void close();

	void listen( int port );
	TcpSocket accept( NetAddress& addr );
	void connect( NetAddress& addr);

	int send( char const * buffer, int length );
	int recv( char* buffer, int length );
	
	bool waitForData( int msec );

	bool isValid() const;
	bool isConnected() const;
	
	private:
	
	TcpSocket( SocketData* data_ ) : data(data_) {};
	
	SocketData* data;
};

#endif // TCPSOCKET_HPP
